package lab02.test21;

import java.util.Scanner;

/**
 * Created by Administrator on 2017/10/31.
 */
public class Test {

    public static  int amount(String s,char c)
    {
        int cmt=0;
        for(int i=0;i<s.length();i++)
        {
            if(s.charAt(i)==c)
            {
                cmt++;
            }

        }
        return cmt;
    }

    public static void main(String args[])
    {
        System.out.println("请输入一串字符");
        String temp;
        Scanner s=new Scanner(System.in);
        temp=s.next();
        System.out.println("其中字母a出现的次数为："+amount(temp,'a')+"次");

    }

}
